<? 


				require("required/dbconnect.php"); 	
				require("required/function.php"); 	
				require("required/header.php"); 
				
				checkAccess("allow_content_management",1);
				$getOverall=mysql_query("select sum(total_visit) as result from os_totalvisit");
				
				
				
?>
				<script language="JavaScript" type="text/javascript" src="required/js/goAjax.js"></script>
				<script>
					
					
					function getStat(){
						
						var month=document.getElementById('month').value;
						var year=document.getElementById('year').value;
						
						
						changeContent('required/js/ajax_visitorstat.php?month='+month+'&year='+year,'divStat','500');
							
					}
				</script>
				
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				
				
					<td width="84%" align="left" valign="top">
					
						
						<table width="100%">
						
							<tr >
							<td colspan="5" class="title">Visitor Statistic</td>
							</tr>
						
						<tr>
							<td>
								<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
							<table width="670" align="left">
								
								<td colspan="3" align="right">View other Month 
								<select name="month" class="text" id="month">
									<? 
										for($m=1;$m<13;$m++){
										 
										if($m==date("n"))
										{
											$slt="selected";
										}else{
											$slt="";
										}
										
									?>
									<option value="<?= date("m",mktime(0,0,0,$m,1,date("Y"))) ?>" <?= $slt ?>><?= date("M",mktime(0,0,0,$m+1,0,date("Y"))) ?></option>
									
									<? } ?>
								</select>
								<select name="year" class="text" id="year">
									<? 
										for($y=2008;$y<=date("Y");$y++){
										 
										if($y==date("Y"))
										{
											$slt="selected";
										}else{
											$slt="";
										}
										
									?>
									<option value="<?= $y ?>" <?= $slt ?>><?= $y ?></option>
									
									<? } ?>
								</select>
								<input type="button" value="Submit" class="button" onClick="getStat()">
								</Td>
						</table>
						</form>
							</td>
						</tr>
						<tr>
							<td colspan="3" class="sub_title">Total Overall Visitors : <?= mysql_result($getOverall,0,"result") ?></td>
						</tr>
						<tr>
							<td colspan="3">
							<div id="divStat">
							</div>
							
							<script>changeContent('required/js/ajax_visitorstat.php?month=<?= date("m") ?>&year=<?= date("Y") ?>','divStat');</script>
							</td>
						</tr>
						
						</table>

					</td>
				 
				</table>
<? require("required/footer.php"); ?>